package com.rainbow.common.handler.properties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;

/**
 * 全局处理配置项
 * @author 付为地
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties(prefix = HandleProperties.RAINBOW_COMMON_HANDLER_PREFIX)
public class HandleProperties {

    /**
     * 配置项前缀
     */
    public static final String RAINBOW_COMMON_HANDLER_PREFIX = "rainbow.common.handler";

    /**
     * 鉴权认证拦截器
     */
    private Auth auth = new Auth();

    /**
     * 鉴权认证拦截器
     */
    @Data
    public static class Auth {

        /**
         * 是否开启鉴权认证
         */
        private boolean enable = true;

        /**
         * auth认证鉴权地址
         */
        private String address;

        /**
         *放行列表,且不重复
         */
        private List<String> includes;

        /**
         *拦截列表,且不重复
         */
        private List<String> excludes;

        /**
         * 白名单token,免验证令牌
         */
        private List<String> skiptokens;
    }

}
